﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.ServiceModel;

namespace ChatService_v2_httpBinding
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Uri uri = new Uri(ConfigurationManager.AppSettings["addr"]);
                ServiceHost host = new ServiceHost(typeof(ChatService), uri);

                //host.AddServiceEndpoint(typeof(IChatService), new NetNamedPipeBinding(), "ChatService");

                host.Open();
                Console.WriteLine("Chat service listen on endpoint {0}", uri.ToString());
                Console.WriteLine("Press ENTER to stop chat service...");
                Console.ReadLine();
                host.Abort();
                host.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Console.ReadLine();
            }
        }
    }
}
